/*
 +----------------------------------------------------------------------
 + Title        : friendApply
 + Author       : huwl
 + Version      : 1.0.0
 + Initial-Time : 2023-03-11
 + Last-time    : 这个文件最后修改的时间 + 修改人的名称
 + Desc         : 好友申请接口
 +----------------------------------------------------------------------
*/

import type { AddFriendApplyParams, EditFriendApplyParams, FriendApplyListParams, FriendApplyListResult } from '@/types/friendApply'
import type { ApiResponse } from '@/types/global'
import request from '@/utils/httpRequest'

/**
 * 添加,请求方式[POST]
 * 
 * @param AddFriendApplyParams data ----------------------------请求参数
 * @returns <any, ApiResponse<any>>
 * @author huwl
 */
export const reqAddFriendApplyAPI = (data: AddFriendApplyParams) => {
    return request<any, ApiResponse<any>>({
        method: 'POST',
        url: 'friendApply/add',
        data
    })
}

/**
 * 删除,请求方式[GET]
 * 
 * @param string ids -------------------------------------------请求参数
 * @returns <any, ApiResponse<any>>
 * @author huwl
 */
export const reqDeleteFriendApplyAPI = (ids: string) => {
    return request<any, ApiResponse<any>>({
        method: 'GET',
        url: 'friendApply/delete',
        params: {ids}
    })
}

/**
 * 编辑,请求方式[POST]
 * 
 * @param EditFriendApplyParams data ---------------------------请求参数
 * @returns <any, ApiResponse<any>>
 * @author huwl
 */
export const reqEditFriendApplyAPI = (data: EditFriendApplyParams) => {
    return request<any, ApiResponse<any>>({
        method: 'POST',
        url: 'friendApply/edit',
        data
    })
}

/**
 * 同意,请求方式[POST]
 * 
 * @param number id --------------------------------------------请求参数
 * @returns <any, ApiResponse<any>>
 * @author huwl
 */
export const reqAgreeFriendApplyAPI = (id: number) => {
    return request<any, ApiResponse<any>>({
        method: 'POST',
        url: 'friendApply/agree',
        data: {id}
    })
}

/**
 * 列表,请求方式[GET]
 * 
 * @param FriendApplyListParams params -------------------------请求参数
 * @returns <any, ApiResponse<FriendApplyListResult>>
 * @author huwl
 */
export const reqFriendApplyListAPI = (params: FriendApplyListParams) => {
    return request<any, ApiResponse<FriendApplyListResult>>({
        method: 'GET',
        url: 'friendApply/list',
        params
    })
}
